﻿Public Class NewName

    Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
        'If txtname.Text = "" Then
        '    MsgBox("No Project Name specified", MsgBoxStyle.Information)
        '    Exit Sub
        'End If
        If txtdatabase.Text = "" Then
            MsgBox("No Database selected", MsgBoxStyle.Information)
            Exit Sub
        End If
        If UCase(System.IO.Path.GetExtension(txtdatabase.Text)) = ".MDB" Then
            Parent1.txttype.Text = "2003"
        ElseIf UCase(System.IO.Path.GetExtension(txtdatabase.Text)) = ".ACCDB" Then
            Parent1.txttype.Text = "2007"
        ElseIf UCase(System.IO.Path.GetExtension(txtdatabase.Text)) = ".SDF" Then
            Parent1.txttype.Text = "2003"
        ElseIf UCase(System.IO.Path.GetExtension(txtdatabase.Text)) = ".XML" Then
            Parent1.txttype.Text = "XML"
        End If
        Parent1.txtprojectName.Text = txtname.Text
        Parent1.txtdb.Text = txtdatabase.Text
        Parent1.txtpassword.Text = txtpass.Text
        Parent1.filltree()
        Me.Close()
    End Sub

    Private Sub btnbrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbrowse.Click
        OpenFileDialog1.ShowDialog()
    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        txtdatabase.Text = OpenFileDialog1.FileName
    End Sub

    Private Sub NewName_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Parent1.Enabled = True
    End Sub

    Private Sub chkpass_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkpass.CheckedChanged
        If chkpass.Checked = True Then
            txtpass.PasswordChar = ""
        ElseIf chkpass.Checked = False Then
            txtpass.PasswordChar = "•"
        End If
    End Sub

    Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click
        Me.Close()
    End Sub
End Class